import URL from '@/config/url'
import utils from '@/utils/utils'

export default{
	// 新增贷款档案
	newLoanArchive(params = {}){
		let data = {
			archive_id:params.id,
			id_no_front:params.id_no_front,
			id_no_back:params.id_no_back,
			name:params.name,
			id_no:params.id_no,
			phone:params.phone,
			is_marry:params.is_marry,
			education:params.education,
			month_income:params.month_income,
			address:params.address,
			province_id:params.province_id,
			city_id:params.city_id,
			district_id:params.district_id,
			province:params.province,
			city:params.city,
			district:params.district,
			urgent_contact:params.urgent_contact
		}
		let url = params.urlStatus==0?'/renovate/LoanArchive/add':'/renovate/LoanArchive/edit';
		return utils.uniRequest({url:URL.BASE + url,data})
	},
	// 新增贷款档案
	newLoanArchives(params = {}){
		let data = {
			archive_id:params.id,
			id_no_front:params.id_no_front,
			id_no_back:params.id_no_back,
			name:params.name,
			id_no:params.id_no,
			phone:params.phone,
			is_marry:params.is_marry,
			education:params.education,
			month_income:params.month_income,
			address:params.address,
			province_id:params.province_id,
			city_id:params.city_id,
			district_id:params.district_id,
			province:params.province,
			city:params.city,
			district:params.district,
			urgent_contact:params.urgent_contact
		}
		return utils.uniRequest({url:URL.BASE + '/renovate/LoanArchive/addNew',data})
	},
	
	// 获取贷款档案详情
	getLoanArchive(params={}){
		return utils.uniRequest({url:URL.BASE + '/renovate/LoanArchive/getDetail'})
	},
	
	// // 编辑贷款档案
	// editLoanArchive(params={}){
	// 	let data = {
	// 		id_no_front:params.id_no_front,
	// 		id_no_back:params.id_no_back,
	// 		name:params.name,
	// 		id_no:params.id_no,
	// 		is_marry:params.is_marry,
	// 		education:params.education,
	// 		month_income:params.month_income,
	// 		address:params.address,
	// 		province_id:params.province_id,
	// 		city_id:params.city_id,
	// 		district_id:params.district_id,
	// 		province:params.province,
	// 		city:params.city,
	// 		district:params.district,
	// 		urgent_contact:params.urgent_contact
	// 	}
	// 	return utils.uniRequest({url:URL.BASE + '/renovate/LoanArchive/edit'},data)
	// },
	
	// 贷款申请
	applyLoan(params={}){
		let data = {
			loan_amount:params.loan_amount,
			repay_term:params.repay_term,
			order_no:params.order_no,
			order_type:params.order_type
		}
		return utils.uniRequest({url:URL.BASE + '/renovate/LoanApply/apply',data})
	},
	
	// 判断贷款申请状态
	getDecLoanStatus(params={}){
		return utils.uniRequest({url:URL.BASE + '/renovate/LoanApply/check'})
	}
}